package com.foundersoftware.commons.organization.dao.impl.hibernate;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.foundersoftware.commons.organization.ObjectAlreadyExistsException;
import com.foundersoftware.commons.organization.PersistenceException;
import com.foundersoftware.commons.organization.dao.IOrganizationDAO;
import com.foundersoftware.commons.organization.model.AbstractOrganizationObject;
import com.foundersoftware.commons.organization.model.Employee;
import com.foundersoftware.commons.organization.model.OrganizationUnit;
import com.foundersoftware.commons.organization.model.OrganizationUnitType;
import com.foundersoftware.commons.organization.model.Position;
import com.foundersoftware.commons.organization.model.PositionType;
import com.foundersoftware.commons.organization.model.Role;
import com.foundersoftware.commons.organization.model.Type;
import com.foundersoftware.commons.organization.model.WorkGroup;
import com.foundersoftware.commons.organization.model.WorkGroupType;

import com.foundersoftware.commons.organization.util.HibernateUtils;

public class OrganizationStoreHibernateImpl implements IOrganizationDAO {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7010305743433275367L;

	
	
	public void deleteEmployee(Employee employee) throws PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteEmployeeWithOgranizationUnitRelation(String employeeId,
			String organizationUnitId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteEmployeeWithPositionRelation(String employeeId,
			String positionId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteEmployeeWithRoleAndWorkGroup(String employeeId,
			String roleId, String workGroupId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteEmployeeWithWorkGroupRelation(String employeeId,
			String workGroupId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteOrganizationUnit(OrganizationUnit organizationUnit)
			throws PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteOrganizationUnitType(
			OrganizationUnitType organizationUnitType)
			throws PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteOrganizationUnitWithOrganizationUnitRelation(
			String superOrgUnitId, String subOrgUnitId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteOrganizationUnitWithOrganizationUnitTypeRelation(
			String organizationUnitId, String organizationUnitTypeId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deletePosition(Position position) throws PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deletePositionType(PositionType positionType)
			throws PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deletePositionWithOrganizationUnitRelation(String positionId,
			String organizationUnitId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deletePositionWithPositionTypeRelation(String positionId,
			String positionTypeId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteResponsibility(AbstractOrganizationObject responsibility)
			throws PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteResponsibilityWithPositonRelation(
			String responsibilityId, String positionId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteResponsibilityWithRoleRelation(String responsibilityId,
			String roleId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteRole(Role role) throws PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteRoleType(Type roleType) throws PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteRoleWithRoleTypeRelation(String roleId, String roleTypeId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteRoleWithWorkGroupRelation(String roleId,
			String workGroupId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteWorkGroup(WorkGroup workGroup)
			throws PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteWorkGroupType(WorkGroupType workGroupType)
			throws PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteWorkGroupWithWorkGroupRelation(String superWorkGroupId,
			String subWorkGroupId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void deleteWorkGroupWithWorkGroupType(String workGroupId,
			String workGroupTypeId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public Employee[] getAllEmployees() {
		// TODO Auto-generated method stub
		return null;
	}

	public OrganizationUnitType[] getAllOrganizationUnitTypes() {
		// TODO Auto-generated method stub
		return null;
	}

	public OrganizationUnit[] getAllOrganizationUnits() {
		// TODO Auto-generated method stub
		return null;
	}

	public PositionType[] getAllPositionTypes() {
		// TODO Auto-generated method stub
		return null;
	}

	public Position[] getAllPositions() {
		// TODO Auto-generated method stub
		return null;
	}

	public AbstractOrganizationObject[] getAllResponsibilities() {
		// TODO Auto-generated method stub
		return null;
	}

	public Type[] getAllRoleTypes() {

		Session session = HibernateUtils.getSessionFactory().openSession();

		  List list =session.createQuery("select roleType from RoleType as roleType").list();
		  session.close();
		  
		  return (Type[])list.toArray(new Type[list.size()]);
		  

	   
	}

	public Role[] getAllRoles() {
		// TODO Auto-generated method stub
		return null;
	}

	public WorkGroupType[] getAllWorkGroupTypes() {
		// TODO Auto-generated method stub
		return null;
	}

	public WorkGroup[] getAllWorkGroups() {
		// TODO Auto-generated method stub
		return null;
	}

	public OrganizationUnit[] getChildOrganizationUnits(
			OrganizationUnit superOrganizationUnit) {
		// TODO Auto-generated method stub
		return null;
	}

	public Employee getEmployee(String employeeid) throws PersistenceException {
		// TODO Auto-generated method stub
		return null;
	}

	public Employee[] getEmployeesOfOrganizationUnit(
			OrganizationUnit organizationUnit, boolean isDirect) {
		// TODO Auto-generated method stub
		return null;
	}

	public OrganizationUnit getOrganizationUnit(String organizationUnitId)
			throws PersistenceException {
		// TODO Auto-generated method stub
		return null;
	}

	public OrganizationUnitType getOrganizationUnitType(
			String organiztionUnitTypeId) throws PersistenceException {
		// TODO Auto-generated method stub
		return null;
	}

	public Position getPosition(String positionId) throws PersistenceException {
		// TODO Auto-generated method stub
		return null;
	}

	public Position getPositionsOfEmployee(Employee employee) {
		// TODO Auto-generated method stub
		return null;
	}

	public Position[] getPositionsOfOrganizationUnit(
			OrganizationUnit organizationUnit) {
		// TODO Auto-generated method stub
		return null;
	}

	public PositionType getPostionType(String positionTypeId)
			throws PersistenceException {
		// TODO Auto-generated method stub
		return null;
	}

	public AbstractOrganizationObject[] getResponsibilitiesOfPosition(
			Position position) {
		// TODO Auto-generated method stub
		return null;
	}

	public AbstractOrganizationObject[] getResponsibilitiesOfRole(Role role) {
		// TODO Auto-generated method stub
		return null;
	}

	public AbstractOrganizationObject getResponsibility(String responsibilityId)
			throws PersistenceException {
		// TODO Auto-generated method stub
		return null;
	}

	public Role getRole(String roleId) throws PersistenceException {
		// TODO Auto-generated method stub
		return null;
	}

	public Type getRoleType(String roleTypeId) throws PersistenceException {
		// TODO Auto-generated method stub
		return null;
	}

	public Role[] getRolesOfEmployee(Employee employee, WorkGroup workGroup) {
		// TODO Auto-generated method stub
		return null;
	}

	public Role[] getRolesOfWorkGroup(WorkGroup workGroup) {
		// TODO Auto-generated method stub
		return null;
	}

	public WorkGroup getWorkGroup(String workGroupId)
			throws PersistenceException {
		// TODO Auto-generated method stub
		return null;
	}

	public WorkGroupType getWorkGroupType(String workGroupTypeId)
			throws PersistenceException {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean isExistsEmployee(String employeeId)
			throws PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsEmployeeWithOgranizationUnitRelation(
			String employeeId, String organizationUnitId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsEmployeeWithPositionRelation(String employeeId,
			String positionId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsEmployeeWithRoleAndWorkGroup(String employeeId,
			String roleId, String workGroupId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsEmployeeWithWorkGroupRelation(String employeeId,
			String workGroupId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsOrganizationUnit(String orgUnitId)
			throws PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsOrganizationUnitType(String orgUnitType)
			throws PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsOrganizationUnitWithOrganizationUnitRelation(
			String superOrgUnitId, String subOrgUnitId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsOrganizationUnitWithOrganizationUnitTypeRelation(
			String organizationUnitId, String organizationUnitTypeId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsPositionWithOrganizationUnitRelation(
			String positionId, String organizationUnitId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsPositionWithPositionTypeRelation(String positionId,
			String positionTypeId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsResponsibilityWithPositonRelation(
			String responsibilityId, String positionId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsResponsibilityWithRoleRelation(
			String responsibilityId, String roleId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsRoleWithRoleTypeRelation(String roleId,
			String roleTypeId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsRoleWithWorkGroupRelation(String roleId,
			String workGroupId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsWorkGroupWithWorkGroupRelation(
			String superWorkGroupId, String subWorkGroupId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isExistsWorkGroupWithWorkGroupType(String workGroupId,
			String workGroupTypeId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub
		return false;
	}

	public void storeEmployee(Employee employee, boolean isCreated)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeEmployeeWithOgranizationUnitRelation(String employeeId,
			String organizationUnitId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeEmployeeWithPositionRelation(String employeeId,
			String positionId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeEmployeeWithRoleAndWorkGroup(String employeeId,
			String roleId, String workGroupId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeEmployeeWithWorkGroupRelation(String employeeId,
			String workGroupId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeOrganizationUnit(OrganizationUnit organizationUnit,
			boolean isCreated) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeOrganizationUnitType(
			OrganizationUnitType organizationUnitType, boolean isCreated)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeOrganizationUnitWithOrganizationUnitRelation(
			String superOrgUnitId, String subOrgUnitId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeOrganizationUnitWithOrganizationUnitTypeRelation(
			String organizationUnitId, String organizationUnitTypeId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storePosition(Position position, boolean isCreated)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storePositionType(PositionType positionType, boolean isCreated)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storePositionWithOrganizationUnitRelation(String positionId,
			String organizationUnitId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storePositionWithPositionTypeRelation(String positionId,
			String positionTypeId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeResponsibility(AbstractOrganizationObject responsibility,
			boolean isCreated) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeResponsibilityWithPositonRelation(String responsibilityId,
			String positionId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeResponsibilityWithRoleRelation(String responsibilityId,
			String roleId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeRole(Role role, boolean isCreated)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeRoleType(Type roleType, boolean isCreated)
			throws ObjectAlreadyExistsException, PersistenceException {
		Session session = HibernateUtils.getSessionFactory().openSession();
		Transaction tx=null;
		tx =session.beginTransaction();
		tx.begin();
		if(isCreated) {
			session.save(roleType);
		} else {
			session.saveOrUpdate(roleType);
		}
		tx.commit();
	}

	public void storeRoleWithRoleTypeRelation(String roleId, String roleTypeId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeRoleWithWorkGroupRelation(String roleId, String workGroupId)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeWorkGroup(WorkGroup workGroup, boolean isCreated)
			throws ObjectAlreadyExistsException, PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeWorkGroupType(WorkGroupType workGroupType,
			boolean isCreated) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeWorkGroupWithWorkGroupRelation(String superWorkGroupId,
			String subWorkGroupId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

	public void storeWorkGroupWithWorkGroupType(String workGroupId,
			String workGroupTypeId) throws ObjectAlreadyExistsException,
			PersistenceException {
		// TODO Auto-generated method stub

	}

}
